<?php

namespace app\rest\validate;

use think\Validate;

class User extends Validate
{

    // 验证规则
    protected $rule = [
        'name' => ['require', 'min' => 2, 'max' => 25],
        'sex' => ['in'=> '0,1,2'],
        'age' => ['number', 'between'=>'1,120'],
        'tel' => ['require', 'regex'=>'/^1[^012]\d{9}$/'],
    ];


    // 提示信息
    protected $message = [
        'name.require' => '用户名必须填写!!!!!',
        'name.min' => '用户名过短',
        'name.max' => '用户名过长',
        'sex.in' => '性别 不对',
        'age.number' => '年龄必须是数字',
    ];


}




